<template>
  <div class="live-tools">
    <div class="operation">
      <div
        class="control"
        @click="toolClick(item)"
        v-for="item in tools"
        :key="item.key"
      >
        <img
          class="tool-icon"
          :src="require(`@/assets/image/room/${item.icon}.png`)"
          alt=""
          srcset=""
        />
        <span>{{ item.name }}</span>
      </div>
    </div>

    <el-button :color="state ? '#fff' : '#d41f1c'" @click="triggerState">{{
      state ? '结束' : '开播'
    }}</el-button>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { ToolsItem } from '@/utils/types'

const state = ref(false) // 开播状态
interface Props {
  tools: ToolsItem[]
}
const props = defineProps<Props>()
const emit = defineEmits(['toolClick'])
function toolClick(item: ToolsItem) {
  emit('toolClick', item)
}
function triggerState() {
  state.value = !state.value
}
</script>

<style scoped lang="scss">
.live-tools {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: fit-content;
  padding: 50px 30px;
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  text-align: center;

  .operation {
    flex: 1;
    margin-bottom: 20px;
    cursor: pointer;

    .control {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-bottom: 20px;

      .tool-icon {
        width: 20px;
        margin-bottom: 4px;
      }
    }
  }
}
</style>
